#include "../Header Files/CSpriteNode_AL.h"
#include "../Header Files/Direct3D_AL.h"

CSpriteNode_AL::CSpriteNode_AL(void)
{
	m_sRenderType = 1;
}
CSpriteNode_AL::CSpriteNode_AL(IDirect3DTexture9* _pTexture, RECT _rect, D3DXVECTOR3 _vPos, D3DXVECTOR3 _vScale)
{
	m_pTexture = _pTexture;
	m_RECT = _rect;
	m_vPosition = _vPos;
	m_vScale = _vScale;
	m_sRenderType = 1;
}
CSpriteNode_AL::~CSpriteNode_AL(void)
{
}
void CSpriteNode_AL::Draw()
{
	D3DXMATRIX position;
	D3DXMatrixIdentity(&position);
	D3DXMatrixTranslation(&position, m_vPosition.x, m_vPosition.y, m_vPosition.z);

	D3DXMATRIX scale;
	D3DXMatrixIdentity(&scale);
	D3DXMatrixScaling(&scale, m_vScale.x, m_vScale.y, m_vScale.z);

	D3DXMatrixMultiply(&scale, &scale, &position);

	Direct3D_AL *D3D = Direct3D_AL::GetInstance();
	D3D->m_pSpriteManager->SetTransform(&scale);

	D3D->m_pSpriteManager->Draw(m_pTexture, &m_RECT, 0, &D3DXVECTOR3(0, 0, 0), D3DCOLOR_XRGB(255,255,255));

	D3DXMatrixIdentity(&scale);
	D3D->m_pSpriteManager->SetTransform(&scale);
}